<template>
  <div class="tmpl">
    <div class="conment">
      <ul>
        <li>{{news}}</li>
      </ul>
    </div>
  </div>
</template>

<script type="text/javascript">
export default{
  data(){
    return{
      news: "我是新闻列表0",
      idx: 0,
      list: [
        {value: "我是新闻列表1"},
        {value: "我是新闻列表2"},
        {value: "我是新闻列表3"},
        {value: "我是新闻列表4"},
        {value: "我是新闻列表5"},
      ]
    }
  },
  methods: {
    swt(){
      var _this = this;
      setInterval(function(){
        _this.news = _this.list[_this.idx].value;
        _this.idx++;
        if(_this.idx == _this.list.length){
          _this.idx = 0;
        }
      },1000)

    }
  },
  created(){
    this.news = this.list[0].value;
    this.swt();
  }
}
</script>

<style type="text/css" scoped>
  .tmpl{
    margin: 20px 0 20px;
  }
    .tmpl ul{
      list-style: none;
    }
</style>